<?php
$urlForm = $view->url(array(
    'controller' => 'Dashboard',
    'action' => 'route'));
if ($view->schedule !== null):
    ?>
    <form class="well" action="<?php echo $urlForm; ?>" method="post">
        <button class="btn btn-small btn-primary pull-right startRoute">
            <i class="icon-play icon-white"></i>
            Iniciar ruta
        </button>
        <h3>Ruta</h3>
        <label>Nombre</label>
        <div class="row-fluid">
            <input type="text" class="span12" disabled value='<?php echo '[' . $view->schedule['code'] . '] ' . $view->schedule['name']; ?>'/>
        </div>
        <label>Fecha</label>
        <div class="row-fluid">
            <input type="text" class="span12" disabled value='<?php echo $view->schedule['startDateTimeRoute']; ?>'/>
        </div>
        <h3>Vehículo</h3>
        <label>Descripción</label>
        <div class="row-fluid">

            <input type="text" class="span12" disabled value='<?php echo $view->schedule['vehicleName']; ?>'/>
        </div>
        <label>Capacidad</label>
        <div class="row-fluid">
            <input type="text" class="span12" disabled value='<?php echo $view->schedule['vehicleCapacity']; ?>'/>
        </div>
        <?php if ($view->points !== null) : ?>
            <h3>Puntos de entrega/recolección</h3>
            <div class="row-fluid">
                <table class="table table-striped table-bordered table-condensed" id='points'>
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>Punto</th>
                            <th>Hora de recolección</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach ($view->points as $key => $package) : ?>
                            <tr>
                                <td><?php echo $key + 1; ?></td>
                                <td><?php echo '[' . $package['pointCode'] . '] ' . $package['pointName']; ?></td>
                                <td title="<?php echo $package['route_date_format']; ?>"><?php echo $package['route_time']; ?></td>
                            </tr>
                        <?php endforeach; ?>
                    </tbody>
                </table>
            </div>
        <?php endif; ?>
        <button class="btn btn-small btn-primary pull-right startRoute">
            <i class="icon-play icon-white"></i>
            Iniciar ruta
        </button>
        <input type="hidden" name="routeId" value='<?php echo $view->schedule['route_id']; ?>'/>
        <input type="hidden" name="scheduleId" value='<?php echo $view->schedule['schedule_id']; ?>'/>
        <br/>
        <br/>
    </form>
<?php else: ?>
    <div class="alert alert-info">
        No se encontraron detalles para la ruta
    </div>
<?php endif; ?>